The Pirate's Assassin Documentation (C) 1988, by David A. Mills SYSTEM REQUIREMENTS: To use The Pirate's Assassin, you will require a Tandy Color Computer 3, Disk BASIC 2.1, one disk drive, and a disk editor/assembler program. PROGRAM FUNCTION: The Pirate's Assassin is an innovative utility designed for Color Computer assembly language programmers. The Pirate's Assassin provides the CoCo pro- grammer with an excellent copy-protection scheme for his valuable creative pro- ducts. The anti-pirate security guarding your ML program will function and hold steadfast on all three versions of the Color Computer and all ROM and Disk BASIC variations. INSTRUCTIONS: 1. Boot up your disk assembler and load PIRASS.ASM into the text editor. You will observe commentary that explains the precise function of each line of code. Next, append your own assembly code, the program you wish to protect, to the PIRASS.ASM file already in memory. ( If you are using Tandy's EDTASM+, the Append command is LDA FILENAME ). If you simply load, rather than append your own code, you will delete from the buffer the PIRASS.ASM file already present. You must APPEND your own code to PIRASS.ASM. Be careful here that the line num- bers of the two files do not overlap each other. 2. Observe in Line 15 of the PIRASS.ASM text that an ORG statement defines the origination address of the code. You may change this ORG statement to ori- ginate the code at any convenient address. Your own code may also contain as many ORG statements as you desire. 3. Insert the execution address (or label) of your own assembly code at the appropriate position on Lines 88 and 94. 4. Assemble the program (the two merged files) to a blank, formatted disk using whatever filename you wish. 5. Return to BASIC. 6. We shall hereafter refer to this disk as the SOURCE disk, the disk con- taining your own assembled code preceded by the PIRASS.ASM code. At this point, don't try to load in your newly-created file, or you will be scolded that "YOU ARE IN ILLEGAL POSSESSION OF PIRATED COMPUTER SOFTWARE." 7. Now, remove your SOURCE disk and replace it with the disk containing "PIRASS.ML". LOADM "PIRASS.ML". After the program starts, remove the disk. 8. Insert a DESTINATION disk to be formatted. The DESTINATION disk is the disk which will soon showcase our finished, copy-protected product. As the pro- gram prompts, "Insert your DESTINATION disk and press the CTRL key." You will see a message, "Now formatting disk to 37 tracks and embedding hidden sector." More about this later. 9. After the DESTINATION disk has been formatted in this nonstandard fashion, you will be prompted to "Insert your SOURCE disk and press the CTRL key." Your entire SOURCE disk will be copied to your DESTINATION disk in only two swaps. After this superfast backup is completed, you will see a message saying, "Backup complete. Track #0 has been unformatted. Press reset to cold start BASIC." After resetting the machine, you may enjoy the fruits of your labor. You may load your program with LOADM "FILENAME". Your program will autoexecute and function as usual. Press the reset button. Your program will restart itself. Try, however, to duplicate your program to another disk using the standard BACKUP or COPY command available in BASIC. You will see that The Pirate's As- sassin has installed copy-protection to secure your program. Try using a spe- cial ML utility that bypasses errors during BACKUP. Still, your program refuses to execute on any other disk. HOW THE PIRATE'S ASSASSIN WORKS: Autostart and Restart: In Line 12 of PIRASS.ASM, the code, when assembled, stores a two-byte ad- dress at memory location $0183 - $0184. This two-byte value is the execution address of the PIRASS.ASM file itself. Immediately after loading a program (or when the reset button is pressed), BASIC vectors into low RAM and jumps to the address contained in locations $0183 and $0184. By replacing the default value of these locations with the execution address of PIRASS.ASM, we have thus pro- grammed our Color Computer to autostart our program after loading is completed. Do not change the address of the ORG statement in Line 11. If you do not wish your program to autostart after loading, simply delete Lines 11 and 12 from the text. Copy Protection: The Pirate's Assassin actually provides, not one, but three separate safe- guards against unauthorized copying of your programs. The first such safeguard involves accessing disk tracks not accessable via Radio Shack's Disk BASIC. Both Disk BASIC versions, 1.0 and 1.1, format, read and write 35 tracks to a disk. While this system software supports only 35 tracks, the hardware -- the Color Computer disk drive itself (whether Tandy or of third-party origin) -- is quite capable of 40-track operation. The Pirate's Assassin first formats the DESTINATION disk to 37 tracks, then writes the word "CoCo" on Track #36, Sector #1. (Because the tracks are numbered beginning with #0, Track #36 is actually the 37th track on the disk.) The PIRASS.ASM file, which you attached to the start of your own code, checks to see whether the word "CoCo" is indeed written on Track #36, Sector #1. If "CoCo" is not found, your program will refuse to execute and will print the warning message men- tioned above. Using Disk BASIC 1.0 or 1.1, you obviously would be unable to completely copy a 37-track disk. Thus, your program enjoys its first line of defense against unauthorized reproduction. But what about ADOS and other Disk ROMS that do indeed support the full 40 tracks? Could they make a copy of a program protected by The Pirate's Assassin? No. After your SOURCE disk has been copied to your DESTINATION disk, The Pirate's Assassin swings the drive head across the disk and deliberately crash- es (unformats) Track #0 of the DESTINATION disk. Any attempt to BACKUP this "flawed" disk -- using a 35- or 40-track DOS -- will fall victim to an I/O error. Could a special utility that bypasses I/O errors make a copy of your pro- tected program, assuming a 40-track DOS were in use? No. Before proceeding further, the PIRASS.ASM code attempts to read Track #0, Sector #1. If this read operation is successful, it means that this track and sector were properly for- matted. In other words, the disk in question is a pirated copy. So, if Track #0 of a pirated disk is formatted -- as it normally would be if the pirate were attempting to BACKUP or COPY your disk to his -- the program will not continue execution and will, instead, print the "Pirated Copy" message. WARNING: Obviously, if The Pirate's Assassin deliberately crashes Track #0, you will be in serious trouble if your assembled program is sitting on Track #0. If you follow instructions, and assemble your program to an EMPTY disk, you should never encounter this problem, because file storage space is generally allocated first to tracks surrounding the directory on Track #17. Only after the disk is nearly full, would Track #0 normally be allocated. Before copying the SOURCE disk to the DESTINATION disk, The Pirate's Assassin checks the GAT of the SOURCE disk to insure that Track #0 has not been allocated. If Track #0 is found to have been allocated, you will be alerted to the problem. Your program does not have to consist only of the code you appended to the PIRASS.ASM file. Your program may load in graphics or other data or executable code from any track-- except Track #0. Always reproduce copies of your program using the original SOURCE disk, never the copy-protected DESTINATION disk, which, as discussed above, causes problems for the DOS. While The Pirate's Assassin does provide a powerful, multi-layered defense against program theft, it would be naive to believe that your program is com- pletely protected. Indeed, the CoCo community is graced with many brilliant programmers and technicians, who can easily reproduce your program if they choose to do so. Rest assured, however, that most who attempt to pirate your software will be unmercifully gunned down by The Pirate's Assassin. PERSONAL APPEAL: If you have any problems, questions or comments about The Pirate's Assas- sin, please contact me: David Mills 2236 Washington Avenue Huntington, West Virginia 25704 (304) 429-1905 CIS #: 75266,243 Delphi Username: DAVIDMILLS The only reward I'm receiving from this project is receiving a message from you. Please write! I'm always looking for new friends and computer pen- pals. In spite of the nature of this program, I DO like to exchange CoCo soft- ware with others.